package date_;

/**
 * @author wly
 * @version V1.0.0
 * @date 2022/12/24 15:10
 */
public class Homework04 {
    public static void main(String[] args) {
        String s1 = "wly";
        Animal a = new Animal(s1);
        Animal b = new Animal(s1);
        System.out.println(a == b);
        System.out.println(a.equals(b));
        System.out.println(a.name == b.name);

        String s4 = new String("wly");
        String s5 = "wly";

        System.out.println(s1 == s4);
        System.out.println(s4 == s5);

        String t1 = "hello" + s1;
        String t2 = "hellowly";
        System.out.println(t1.intern() == t2);
    }
}

class Animal{
    String name;
    public Animal(String name){
        this.name = name;
    }
}
